Repository navigation
Conversation
Typing "/" loads slash commands through ensure_session, which spawns the omp session before its first prompt. omp writes the session file only once the first message is committed, so the pre-dispatch boundary read (context?boundary=1) returned 404 and the send failed with "HTTP 404". Return an empty boundary for a live, idle wrapper whose file does not exist yet. An in-flight unpersisted run still returns 404, so its entries are never attributed to the next prompt. Fixes ompweb-dev#160
Broglah1
commented
Sep 28, 2026
Contributor
Author
There was a problem hiding this comment.
#165 fixes the same bug (#160) in the same place, app/api/sessions/[id]/context/route.ts, and is the better of the two fixes.
The two differ only while a new session's first reply is still running and not yet saved. This PR still returns 404 for context?boundary=1 then; #165 returns { entryIds: [] }. #165 matches how sessions that already have a file behave mid-run (the boundary lists what has been saved), so the extra 404 here would only make interrupt-and-reply fail during a new session's first reply.
Checked locally on both branches (Windows 11, omp 18.4.2):
Contributor
Author
|
Closing in favour of #165, which fixes the same bug. See the review above for the comparison. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #160
Summary
/loads slash commands throughensure_session, which spawns the omp session before its first prompt. omp writes the session.jsonlonly once the first message is committed, so on Send the pre-dispatch boundary read (GET /api/sessions/<id>/context?boundary=1) found no file, returned404 session_not_found, andsnapshotRunEntriesaborted the send with Failed to send message: HTTP 404. Every slash command in a new session hit this (/pbr,/new, skills, prompt templates).{ entryIds: [] }forboundary=1when the session's wrapper is live and idle and its file does not exist yet: it has persisted nothing, so its boundary is empty. This mirrors the existingsync=1handling of a live wrapper without a file.boundary never substitutes unpersisted live outputguard is unchanged), so that run's entries are never attributed to the next prompt. A missing file without a live wrapper is still 404.Validation
lib/session-routes.test.mjs: idle live wrapper without a file →200 { entryIds: [] }; afteragent_start→ 404; wrapper removed → 404. Fails without the fix (actual: 404, expected: 200), passes with it.npm run typecheck,npm run lint(0 errors; changed files clean),npm test: 905 pass / 0 fail (1 skipped)/new→ Send. Typing/spawns the session (POST /api/agent/new200); Send now issuescontext?boundary=1→ 200 and the prompt → 200, with no error notice. The same steps on published 0.5.1 fail with HTTP 404.npm run buildnot run locally (dev-tree rule in AGENTS.md); CI covers it.